public class StudentSelection implements Comparable<StudentSelection> {

    private String name;
    private int score;

    public StudentSelection(String name, int score){
        this.name = name;
        this.score = score;
    }

    @Override
    public int compareTo(StudentSelection another){
        if(this.score < another.score)
            return -1;
        else if(this.score == another.score)
            return 0;
        return 1;
    }

    @Override
    public boolean equals(Object student){

        if(this == student)
            return true;

        if(student == null)
            return false;

        if(this.getClass() != student.getClass())
            return false;

        StudentSelection another = (StudentSelection)student;
        return this.name.toLowerCase().equals(another.name.toLowerCase());
    }

    @Override
    public String toString(){
        return String.format("Student(name: %s,score: %d)",name,score);
    }

    // 自定义泛型数组
    public static void main(String[] args){
        Array<StudentSelection> arr = new Array<>();
        arr.addLast(new StudentSelection("Alice",100));
        arr.addLast(new StudentSelection("Bob",66));
        arr.addLast(new StudentSelection("Charlie",88));
        System.out.println(arr);
    }
}
